package nl.nhl.idp.Components.Database;

import java.text.DateFormat;
import java.util.Date;

public class Session
{
	private int session_id;
	private long startTime;
	private long endTime;
	
	public Session()
	{
		this.session_id = 0;
		this.startTime = 0;
		this.endTime = 0;
	}
	
	public Session(long start)
	{
		this.session_id = 0;
		this.startTime = start;
		this.endTime = 0;
	}
	
	public int getID()
	{
		return this.session_id;
	}
	
	public void setStartTime(long time)
	{
		startTime = time;
	}
	
	public void setEndTime(long time)
	{
		endTime = time;
	}
	
	public void setID(int id)
	{
		this.session_id = id;
	}
	
	public String getStartTime()
	{
		DateFormat dateF = DateFormat.getDateTimeInstance();
	    return dateF.format(new Date(startTime));
	}
	
	public long getEndTimeLong()
	{
		return endTime;
	}
	
	public String getEndTime()
	{
		if(this.endTime != 0)
		{
			DateFormat dateF = DateFormat.getDateTimeInstance();
		    return dateF.format(new Date(endTime));
		}
		else
		{
			return "No end time!";
		}
	}
}
